package com.ecpss;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Lianxi4 {
    public static void main(String[] args) {
//        \w	匹配任何字类字符，包括下划线。与"[A-Za-z0-9_]"等效
//        \W	匹配任何非单词字符。与"[^A-Za-z0-9_]"等效

//        Pattern compile = Pattern.compile("\\w");
        Pattern compile = Pattern.compile("\\W\\W");
        Matcher matcher = compile.matcher("x12c吃饭@#s");
        while (matcher.find()) {
            System.out.println(matcher.group(0));//吃饭@
        }
    }
}
